package com.cmii.sjw.department.control.enums;

import java.util.Arrays;

/**
 * @Author jfh
 * @Date 2025-03-13 周四 11:24
 * @Version 1.0
 */
public enum AnswerSourceTypeEnum {
    KNOWLEDGE_FAQ(20, "知识库-FAQ"),
    KNOWLEDGE_EXPERIENCE(21, "知识库-经验"),
    KNOWLEDGE_DOCUMENT(22, "知识库-文档"),
    KNOWLEDGE_COURSE(23, "知识库-课程"),
    KNOWLEDGE_ENCYCLOPEDIA(24, "知识库-百科"),
    KNOWLEDGE_GRAPH(25, "知识库-知识图谱"),

    PLUGIN_CUSTOM_CODE(8, "插件-自定义代码"),
    PLUGIN_DATA_SUBJECT(9, "插件-数据主题"),
    PLUGIN_DATA_VIEW(10, "插件-数据视图"),
    PLUGIN_KNOWLEDGE_GRAPH(11, "插件-知识图谱"),
    PLUGIN_API_CALL(12, "插件-调用API"),
    PLUGIN_REASONING(13, "插件-推理"),
    PLUGIN_BUSINESS_PROCESS(14, "插件-业务流程"),
    PLUGIN_REALTIME_TASK(15, "插件-实时任务"),

    LLM(5, "大模型"),

    OTHER(0, "其他");

    private final int code;
    private final String description;

    AnswerSourceTypeEnum(int code, String description) {
        this.code = code;
        this.description = description;
    }

    public int getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }
    public static AnswerSourceTypeEnum parse(String value) {
        return Arrays.stream(values())
                .filter(e -> e.name().equalsIgnoreCase(value))
                .findFirst()
                .orElse(null);
    }

    public static AnswerSourceTypeEnum valueOf(int code) {
        for (AnswerSourceTypeEnum type : values()) {
            if (type.code == code) {
                return type;
            }
        }
        return null;
    }
}

